package com.zcl;

/**
 * @Description:
 * @author: zcl
 * @date: 2021/12/9  14:54
 */
public class Flower {
    private int petalCount = 0;
    private String s = new String("null");

    Flower(){
        this("hi",47);
        System.out.println("default constructor");
    }
    Flower(int petals){
        petalCount = petals;
        initMethod();
        System.out.println("Int constructor");
    }
    Flower(String ss){
        s = ss;
        System.out.println("String constructor");
    }
    Flower(String s, int petals){
        this(petals);
//        this(s);这里String 和int 只能用一个
        this.s = s;
        System.out.println("String and Int constructor");
    }
    void print(){
//        this(11);
        System.out.println("petalCount = "+ petalCount + ",s = "+ s);
    }

    static void initMethod(){
        System.out.println("initMethod");
    }


    public static void main(String[] args) {
        Flower flower = new Flower();
        flower.print();
        Flower haha = new Flower("haha");
        haha.print();
        Flower.initMethod();
    }
}
